package linkedhashset;

import java.util.HashSet;
import java.util.LinkedHashSet;

/**
 * Created by 5406160@qq.com on LiBoWen 李博闻.
 *
 * @ClassName : LinkeHashSetDemo
 * @Author : 54061
 * @Date: 2022/2/9 8:44
 */
public class LinkeHashSetDemo {
    public static void main(String[] args) {
        //创建集合对象
        HashSet<String> set = new HashSet<>();
        System.out.println("set = " + set);

        //添加元素
        set.add("张三丰");
        set.add("张翠山");
        set.add("张无忌");
        System.out.println("set = " + set);

        //创建集合对象
        LinkedHashSet<String> set1 = new LinkedHashSet<>();
        System.out.println("set1 = " + set1);

        //添加元素
        set1.add("张三丰");
        set1.add("张翠山");
        set1.add("张无忌");
        set1.add("张三丰");
        set1.add("张翠山");
        set1.add("张无忌");
        System.out.println("set1 = " + set1);

    }
}
